/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package account;

import directory.DirectoryManipulation;
import java.text.ParseException;
import java.text.SimpleDateFormat;

/**
 *
 * @author M I
 */
public class AccountManipulation {

    public void createAccount(String path,String...list){
        Account account=new Account();
        
        account.setUserName(list[0]);
        account.setPassword(list[1]);
        account.setFirstName(list[2]);
        account.setLastName(list[3]);
        account.setAlternativeMail(list[4]);
        account.setSecurityQn(list[5]);
        account.setQnAnswer(list[6]);
        account.setCountry(list[7]);
        account.setCity(list[8]);
        account.setPostalCode(list[9]);
        account.setGender(list[10]);
        SimpleDateFormat format=new SimpleDateFormat("dd MM yyyy");
        try{
        account.setBirthday(format.parse(list[11]));
        }
        catch (ParseException ex){
            throw new IllegalArgumentException("Can't parse date!");
        }
        boolean status=DirectoryManipulation.mkDir(path);
        if (!status)
            javax.swing.JOptionPane.showMessageDialog(null, "Can't create folder");
        
    }

}
